import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    params: data
  })
}

export function register(data) {
  return request({
    url: '/user/register',
    method: 'post',
    params: data
  })
}

export function getInfo() {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

export function logout(data) {
  return request({
    url: '/user/logout',
    method: 'post',
    params: data
  })
}

// 根据id查询用户信息信息
export function getUserById(id) {
  return request({
    baseURL: 'http://localhost:8001',
    url: `/userInfo/getUserById/${id}`,
    method: 'get'
  })
}
// 修改用户基本信息
export function updateUserInfo(userInfo) {
  return request({
    baseURL: 'http://localhost:8001',
    url: `/userInfo/updateUserInfo`,
    method: 'post',
    data: userInfo
  })
}
export function channgePass(username, password) {
  return request({
    /* baseURL: 'http://localhost:8000',*/
    url: `/user/updatePassword`,
    method: 'put',
    params: {
      username, password
    }
  })
}

